//
//  ViewController.swift
//  MVVMDemo1
//
//  Created by 李煜 on 2024/6/7.
//

import UIKit

class ViewController: UIViewController {
    @IBOutlet weak var usernameLabel: UILabel!
    
    @IBOutlet weak var emailLabel: UILabel!
    var viewModel: UserViewModel = UserViewModel()
    
    override func viewDidLoad() {
        super.viewDidLoad()


        viewModel.updateView = { [weak self] in
            self?.updateUI()
        }
        
        
    }
    
    private func updateUI() {
        usernameLabel.text = viewModel.username
        emailLabel.text = viewModel.email
    }


}

